"use strict";var Me=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var _t=Object.prototype.hasOwnProperty;var Lt=(e,t)=>{for(var r in t)Me(e,r,{get:t[r],enumerable:!0})},Pe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vt(t))!_t.call(e,o)&&o!==r&&Me(e,o,{get:()=>t[o],enumerable:!(n=Ft(t,o))||n.enumerable});return e},w=(e,t,r)=>(Pe(e,t,"default"),r&&Pe(r,t,"default"));var Ut=e=>Pe(Me({},"__esModule",{value:!0}),e);var S={};Lt(S,{ReducerType:()=>We,SHOULD_AUTOBATCH:()=>de,TaskAbortError:()=>I,Tuple:()=>j,addListener:()=>Ee,asyncThunkCreator:()=>pt,autoBatchEnhancer:()=>ue,buildCreateSlice:()=>ze,clearAllListeners:()=>$e,combineSlices:()=>jt,configureStore:()=>dt,createAction:()=>M,createActionCreatorInvariantMiddleware:()=>Ze,createAsyncThunk:()=>he,createDraftSafeSelector:()=>re,createDraftSafeSelectorCreator:()=>be,createDynamicMiddleware:()=>Ot,createEntityAdapter:()=>St,createImmutableStateInvariantMiddleware:()=>tt,createListenerMiddleware:()=>vt,createNextState:()=>D.produce,createReducer:()=>pe,createSelector:()=>W.createSelector,createSelectorCreator:()=>W.createSelectorCreator,createSerializableStateInvariantMiddleware:()=>ot,createSlice:()=>ft,current:()=>D.current,findNonSerializableValue:()=>Ne,formatProdErrorMessage:()=>m,freeze:()=>D.freeze,isActionCreator:()=>ae,isAllOf:()=>K,isAnyOf:()=>V,isAsyncThunkAction:()=>_e,isDraft:()=>D.isDraft,isFluxStandardAction:()=>ie,isFulfilled:()=>Ve,isImmutableDefault:()=>et,isPending:()=>je,isPlain:()=>Oe,isRejected:()=>X,isRejectedWithValue:()=>Fe,lruMemoize:()=>W.lruMemoize,miniSerializeError:()=>Le,nanoid:()=>b,original:()=>D.original,prepareAutoBatched:()=>it,removeListener:()=>we,unwrapResult:()=>Ue,weakMapMemoize:()=>W.weakMapMemoize});module.exports=Ut(S);w(S,require("redux"),module.exports);var D=require("immer"),W=require("reselect");var te=require("immer"),ne=require("reselect"),be=(...e)=>{let t=(0,ne.createSelectorCreator)(...e),r=Object.assign((...n)=>{let o=t(...n),a=(s,...p)=>o((0,te.isDraft)(s)?(0,te.current)(s):s,...p);return Object.assign(a,o),a},{withTypes:()=>r});return r},re=be(ne.weakMapMemoize);var v=require("redux");var Ie=require("redux"),Ye=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ie.compose:Ie.compose.apply(null,arguments)},Rn=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}};var ce=require("redux-thunk");var ve=require("redux");var oe=e=>e&&typeof e.match=="function";function M(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(m(0));return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>(0,ve.isAction)(n)&&n.type===e,r}function ae(e){return typeof e=="function"&&"type"in e&&oe(e)}function ie(e){return(0,ve.isAction)(e)&&Object.keys(e).every(Wt)}function Wt(e){return["type","payload","error","meta"].indexOf(e)>-1}function zt(e){let t=e?`${e}`.split("/"):[],r=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. 
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${r}())\` instead of \`dispatch(${r})\`. This is necessary even if the action has no payload.`}function Ze(e={}){return()=>r=>n=>r(n)}var se=require("immer");function $(e,t){for(let r of e)if(t(r))return r}var j=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function De(e){return(0,se.isDraftable)(e)?(0,se.produce)(e,()=>{}):e}function G(e,t,r){if(e.has(t)){let o=e.get(t);return r.update&&(o=r.update(o,t,e),e.set(t,o)),o}if(!r.insert)throw new Error(m(10));let n=r.insert(t,e);return e.set(t,n),n}function et(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function tt(e={}){if(1)return()=>n=>o=>n(o);var t,r}var nt=require("redux");function Oe(e){let t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||(0,nt.isPlainObject)(e)}function Ne(e,t="",r=Oe,n,o=[],a){let s;if(!r(e))return{keyPath:t||"<root>",value:e};if(typeof e!="object"||e===null||a?.has(e))return!1;let p=n!=null?n(e):Object.entries(e),c=o.length>0;for(let[A,i]of p){let u=t?t+"."+A:A;if(!(c&&o.some(k=>k instanceof RegExp?k.test(u):u===k))){if(!r(i))return{keyPath:u,value:i};if(typeof i=="object"&&(s=Ne(i,u,r,n,o,a),s))return s}}return a&&rt(e)&&a.add(e),!1}function rt(e){if(!Object.isFrozen(e))return!1;for(let t of Object.values(e))if(!(typeof t!="object"||t===null)&&!rt(t))return!1;return!0}function ot(e={}){return()=>t=>r=>t(r)}function Gt(e){return typeof e=="boolean"}var at=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},s=new j;return r&&(Gt(r)?s.push(ce.thunk):s.push((0,ce.withExtraArgument)(r.extraArgument))),s};var de="RTK_autoBatch",it=()=>e=>({payload:e,meta:{[de]:!0}}),st=e=>t=>{setTimeout(t,e)},Bt=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:st(10),ue=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,s=!1,p=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?Bt:e.type==="callback"?e.queueNotification:st(e.timeout),A=()=>{s=!1,a&&(a=!1,p.forEach(i=>i()))};return Object.assign({},n,{subscribe(i){let u=()=>o&&i(),y=n.subscribe(u);return p.add(i),()=>{y(),p.delete(i)}},dispatch(i){try{return o=!i?.meta?.[de],a=!o,a&&(s||(s=!0,c(A))),n.dispatch(i)}finally{o=!0}}})};var ct=e=>function(r){let{autoBatch:n=!0}=r??{},o=new j(e);return n&&o.push(ue(typeof n=="object"?n:void 0)),o};var F=!0;function dt(e){let t=at(),{reducer:r=void 0,middleware:n,devTools:o=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},p;if(typeof r=="function")p=r;else if((0,v.isPlainObject)(r))p=(0,v.combineReducers)(r);else throw new Error(m(1));if(!F&&n&&typeof n!="function")throw new Error(m(2));let c;if(typeof n=="function"){if(c=n(t),!F&&!Array.isArray(c))throw new Error(m(3))}else c=t();if(!F&&c.some(l=>typeof l!="function"))throw new Error(m(4));let A=v.compose;o&&(A=Ye({trace:!F,...typeof o=="object"&&o}));let i=(0,v.applyMiddleware)(...c),u=ct(i);if(!F&&s&&typeof s!="function")throw new Error(m(5));let y=typeof s=="function"?s(u):u();if(!F&&!Array.isArray(y))throw new Error(m(6));if(!F&&y.some(l=>typeof l!="function"))throw new Error(m(7));!F&&c.length&&!y.includes(i)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");let k=A(...y);return(0,v.createStore)(p,a,k)}var B=require("immer");function le(e){let t={},r=[],n,o={addCase(a,s){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(m(28));if(p in t)throw new Error(m(29));return t[p]=s,o},addMatcher(a,s){return r.push({matcher:a,reducer:s}),o},addDefaultCase(a){return n=a,o}};return e(o),[t,r,n]}function Kt(e){return typeof e=="function"}function pe(e,t){let[r,n,o]=le(t),a;if(Kt(e))a=()=>De(e());else{let p=De(e);a=()=>p}function s(p=a(),c){let A=[r[c.type],...n.filter(({matcher:i})=>i(c)).map(({reducer:i})=>i)];return A.filter(i=>!!i).length===0&&(A=[o]),A.reduce((i,u)=>{if(u)if((0,B.isDraft)(i)){let k=u(i,c);return k===void 0?i:k}else{if((0,B.isDraftable)(i))return(0,B.produce)(i,y=>u(y,c));{let y=u(i,c);if(y===void 0){if(i===null)return i;throw new Error(m(9))}return y}}return i},p)}return s.getInitialState=a,s}var Ht="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",b=(e=21)=>{let t="",r=e;for(;r--;)t+=Ht[Math.random()*64|0];return t};var ut=(e,t)=>oe(e)?e.match(t):e(t);function V(...e){return t=>e.some(r=>ut(r,t))}function K(...e){return t=>e.every(r=>ut(r,t))}function fe(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function J(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function je(...e){return e.length===0?t=>fe(t,["pending"]):J(e)?V(...e.map(t=>t.pending)):je()(e[0])}function X(...e){return e.length===0?t=>fe(t,["rejected"]):J(e)?V(...e.map(t=>t.rejected)):X()(e[0])}function Fe(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?K(X(...e),t):J(e)?K(X(...e),t):Fe()(e[0])}function Ve(...e){return e.length===0?t=>fe(t,["fulfilled"]):J(e)?V(...e.map(t=>t.fulfilled)):Ve()(e[0])}function _e(...e){return e.length===0?t=>fe(t,["pending","fulfilled","rejected"]):J(e)?V(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):_e()(e[0])}var qt=["name","message","stack","code"],Q=class{constructor(t,r){this.payload=t;this.meta=r}_type},ye=class{constructor(t,r){this.payload=t;this.meta=r}_type},Le=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of qt)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},he=(()=>{function e(t,r,n){let o=M(t+"/fulfilled",(c,A,i,u)=>({payload:c,meta:{...u||{},arg:i,requestId:A,requestStatus:"fulfilled"}})),a=M(t+"/pending",(c,A,i)=>({payload:void 0,meta:{...i||{},arg:A,requestId:c,requestStatus:"pending"}})),s=M(t+"/rejected",(c,A,i,u,y)=>({payload:u,error:(n&&n.serializeError||Le)(c||"Rejected"),meta:{...y||{},arg:i,requestId:A,rejectedWithValue:!!u,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function p(c){return(A,i,u)=>{let y=n?.idGenerator?n.idGenerator(c):b(),k=new AbortController,l,h;function x(d){h=d,k.abort()}let f=async function(){let d;try{let g=n?.condition?.(c,{getState:i,extra:u});if($t(g)&&(g=await g),g===!1||k.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let E=new Promise((C,R)=>{l=()=>{R({name:"AbortError",message:h||"Aborted"})},k.signal.addEventListener("abort",l)});A(a(y,c,n?.getPendingMeta?.({requestId:y,arg:c},{getState:i,extra:u}))),d=await Promise.race([E,Promise.resolve(r(c,{dispatch:A,getState:i,extra:u,requestId:y,signal:k.signal,abort:x,rejectWithValue:(C,R)=>new Q(C,R),fulfillWithValue:(C,R)=>new ye(C,R)})).then(C=>{if(C instanceof Q)throw C;return C instanceof ye?o(C.payload,y,c,C.meta):o(C,y,c)})])}catch(g){d=g instanceof Q?s(null,y,c,g.payload,g.meta):s(g,y,c)}finally{l&&k.signal.removeEventListener("abort",l)}return n&&!n.dispatchConditionRejection&&s.match(d)&&d.meta.condition||A(d),d}();return Object.assign(f,{abort:x,requestId:y,arg:c,unwrap(){return f.then(Ue)}})}}return Object.assign(p,{pending:a,rejected:s,fulfilled:o,settled:V(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function Ue(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function $t(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var lt=Symbol.for("rtk-slice-createasyncthunk"),pt={[lt]:he},We=(n=>(n.reducer="reducer",n.reducerWithPrepare="reducerWithPrepare",n.asyncThunk="asyncThunk",n))(We||{});function Xt(e,t){return`${e}/${t}`}function ze({creators:e}={}){let t=e?.asyncThunk?.[lt];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(m(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(Qt()):n.reducers)||{},p=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},A={addCase(d,T){let g=typeof d=="string"?d:d.type;if(!g)throw new Error(m(12));if(g in c.sliceCaseReducersByType)throw new Error(m(13));return c.sliceCaseReducersByType[g]=T,A},addMatcher(d,T){return c.sliceMatchers.push({matcher:d,reducer:T}),A},exposeAction(d,T){return c.actionCreators[d]=T,A},exposeCaseReducer(d,T){return c.sliceCaseReducersByName[d]=T,A}};p.forEach(d=>{let T=s[d],g={reducerName:d,type:Xt(o,d),createNotation:typeof n.reducers=="function"};Zt(T)?tn(g,T,A,t):Yt(g,T,A)});function i(){let[d={},T=[],g=void 0]=typeof n.extraReducers=="function"?le(n.extraReducers):[n.extraReducers],E={...d,...c.sliceCaseReducersByType};return pe(n.initialState,C=>{for(let R in E)C.addCase(R,E[R]);for(let R of c.sliceMatchers)C.addMatcher(R.matcher,R.reducer);for(let R of T)C.addMatcher(R.matcher,R.reducer);g&&C.addDefaultCase(g)})}let u=d=>d,y=new Map,k;function l(d,T){return k||(k=i()),k(d,T)}function h(){return k||(k=i()),k.getInitialState()}function x(d,T=!1){function g(C){let R=C[d];return typeof R>"u"&&T&&(R=h()),R}function E(C=u){let R=G(y,T,{insert:()=>new WeakMap});return G(R,C,{insert:()=>{let z={};for(let[N,ee]of Object.entries(n.selectors??{}))z[N]=Jt(ee,C,h,T);return z}})}return{reducerPath:d,getSelectors:E,get selectors(){return E(g)},selectSlice:g}}let f={name:o,reducer:l,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:h,...x(a),injectInto(d,{reducerPath:T,...g}={}){let E=T??a;return d.inject({reducerPath:E,reducer:l},g),{...f,...x(E,!0)}}};return f}}function Jt(e,t,r,n){function o(a,...s){let p=t(a);return typeof p>"u"&&n&&(p=r()),e(p,...s)}return o.unwrapped=e,o}var ft=ze();function Qt(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Yt({type:e,reducerName:t,createNotation:r},n,o){let a,s;if("reducer"in n){if(r&&!en(n))throw new Error(m(17));a=n.reducer,s=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,s?M(e,s):M(e))}function Zt(e){return e._reducerDefinitionType==="asyncThunk"}function en(e){return e._reducerDefinitionType==="reducerWithPrepare"}function tn({type:e,reducerName:t},r,n,o){if(!o)throw new Error(m(18));let{payloadCreator:a,fulfilled:s,pending:p,rejected:c,settled:A,options:i}=r,u=o(e,a,i);n.exposeAction(t,u),s&&n.addCase(u.fulfilled,s),p&&n.addCase(u.pending,p),c&&n.addCase(u.rejected,c),A&&n.addMatcher(u.settled,A),n.exposeCaseReducer(t,{fulfilled:s||Ae,pending:p||Ae,rejected:c||Ae,settled:A||Ae})}function Ae(){}function nn(){return{ids:[],entities:{}}}function yt(e){function t(r={},n){let o=Object.assign(nn(),r);return n?e.setAll(o,n):o}return{getInitialState:t}}function ht(){function e(t,r={}){let{createSelector:n=re}=r,o=u=>u.ids,a=u=>u.entities,s=n(o,a,(u,y)=>u.map(k=>y[k])),p=(u,y)=>y,c=(u,y)=>u[y],A=n(o,u=>u.length);if(!t)return{selectIds:o,selectEntities:a,selectAll:s,selectTotal:A,selectById:n(a,p,c)};let i=n(t,a);return{selectIds:n(t,o),selectEntities:i,selectAll:n(t,s),selectTotal:n(t,A),selectById:n(i,p,c)}}return{getSelectors:e}}var Tt=require("immer");var Te=require("immer");var rn=Te.isDraft;function At(e){let t=P((r,n)=>e(n));return function(n){return t(n,void 0)}}function P(e){return function(r,n){function o(s){return ie(s)}let a=s=>{o(n)?e(n.payload,s):e(n,s)};return rn(r)?(a(r),r):(0,Te.produce)(r,a)}}var Y=require("immer");function _(e,t){return t(e)}function O(e){return Array.isArray(e)||(e=Object.values(e)),e}function Ge(e){return(0,Y.isDraft)(e)?(0,Y.current)(e):e}function me(e,t,r){e=O(e);let n=(0,Y.current)(r.ids),o=new Set(n),a=[],s=[];for(let p of e){let c=_(p,t);o.has(c)?s.push({id:c,changes:p}):a.push(p)}return[a,s,n]}function Se(e){function t(l,h){let x=_(l,e);x in h.entities||(h.ids.push(x),h.entities[x]=l)}function r(l,h){l=O(l);for(let x of l)t(x,h)}function n(l,h){let x=_(l,e);x in h.entities||h.ids.push(x),h.entities[x]=l}function o(l,h){l=O(l);for(let x of l)n(x,h)}function a(l,h){l=O(l),h.ids=[],h.entities={},r(l,h)}function s(l,h){return p([l],h)}function p(l,h){let x=!1;l.forEach(f=>{f in h.entities&&(delete h.entities[f],x=!0)}),x&&(h.ids=h.ids.filter(f=>f in h.entities))}function c(l){Object.assign(l,{ids:[],entities:{}})}function A(l,h,x){let f=x.entities[h.id];if(f===void 0)return!1;let d=Object.assign({},f,h.changes),T=_(d,e),g=T!==h.id;return g&&(l[h.id]=T,delete x.entities[h.id]),x.entities[T]=d,g}function i(l,h){return u([l],h)}function u(l,h){let x={},f={};l.forEach(T=>{T.id in h.entities&&(f[T.id]={id:T.id,changes:{...f[T.id]?f[T.id].changes:null,...T.changes}})}),l=Object.values(f),l.length>0&&l.filter(g=>A(x,g,h)).length>0&&(h.ids=Object.values(h.entities).map(g=>_(g,e)))}function y(l,h){return k([l],h)}function k(l,h){let[x,f]=me(l,e,h);u(f,h),r(x,h)}return{removeAll:At(c),addOne:P(t),addMany:P(r),setOne:P(n),setMany:P(o),setAll:P(a),updateOne:P(i),updateMany:P(u),upsertOne:P(y),upsertMany:P(k),removeOne:P(s),removeMany:P(p)}}function on(e,t,r){let n=0,o=e.length;for(;n<o;){let a=n+o>>>1,s=e[a];r(t,s)>=0?n=a+1:o=a}return n}function an(e,t,r){let n=on(e,t,r);return e.splice(n,0,t),e}function mt(e,t){let{removeOne:r,removeMany:n,removeAll:o}=Se(e);function a(f,d){return s([f],d)}function s(f,d,T){f=O(f);let g=new Set(T??(0,Tt.current)(d.ids)),E=f.filter(C=>!g.has(_(C,e)));E.length!==0&&x(d,E)}function p(f,d){return c([f],d)}function c(f,d){if(f=O(f),f.length!==0){for(let T of f)delete d.entities[e(T)];x(d,f)}}function A(f,d){f=O(f),d.entities={},d.ids=[],s(f,d,[])}function i(f,d){return u([f],d)}function u(f,d){let T=!1,g=!1;for(let E of f){let C=d.entities[E.id];if(!C)continue;T=!0,Object.assign(C,E.changes);let R=e(C);if(E.id!==R){g=!0,delete d.entities[E.id];let z=d.ids.indexOf(E.id);d.ids[z]=R,d.entities[R]=C}}T&&x(d,[],T,g)}function y(f,d){return k([f],d)}function k(f,d){let[T,g,E]=me(f,e,d);g.length&&u(g,d),T.length&&s(T,d,E)}function l(f,d){if(f.length!==d.length)return!1;for(let T=0;T<f.length&&T<d.length;T++)if(f[T]!==d[T])return!1;return!0}let x=(f,d,T,g)=>{let E=Ge(f.entities),C=Ge(f.ids),R=f.entities,z=C;g&&(z=Array.from(new Set(C)));let N=[];for(let q of z){let Qe=E[q];Qe&&N.push(Qe)}let ee=N.length===0;for(let q of d)R[e(q)]=q,ee||an(N,q,t);ee?N=d.slice().sort(t):T&&N.sort(t);let Je=N.map(e);l(C,Je)||(f.ids=Je)};return{removeOne:r,removeMany:n,removeAll:o,addOne:P(a),updateOne:P(i),upsertOne:P(y),setOne:P(p),setMany:P(c),setAll:P(A),addMany:P(s),updateMany:P(u),upsertMany:P(k)}}function St(e={}){let{selectId:t,sortComparer:r}={sortComparer:!1,selectId:s=>s.id,...e},n=r?mt(t,r):Se(t),o=yt(n),a=ht();return{selectId:t,sortComparer:r,...o,...a,...n}}var Mt=require("redux");var sn="task",gt="listener",kt="completed",Be="cancelled",xt=`task-${Be}`,Ct=`task-${kt}`,ge=`${gt}-${Be}`,Rt=`${gt}-${kt}`,I=class{constructor(t){this.code=t;this.message=`${sn} ${Be} (reason: ${t})`}name="TaskAbortError";message};var ke=(e,t)=>{if(typeof e!="function")throw new Error(m(32))},H=()=>{},xe=(e,t=H)=>(e.catch(t),e),Ce=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),L=(e,t)=>{let r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))};var U=e=>{if(e.aborted){let{reason:t}=e;throw new I(t)}};function Ke(e,t){let r=H;return new Promise((n,o)=>{let a=()=>o(new I(e.reason));if(e.aborted){a();return}r=Ce(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=H})}var Et=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof I?"cancelled":"rejected",error:r}}finally{t?.()}},Z=e=>t=>xe(Ke(e,t).then(r=>(U(e),r))),He=e=>{let t=Z(e);return r=>t(new Promise(n=>setTimeout(n,r)))};var{assign:cn}=Object,wt={},Re="listenerMiddleware",dn=(e,t)=>{let r=n=>Ce(e,()=>L(n,e.reason));return(n,o)=>{ke(n,"taskExecutor");let a=new AbortController;r(a);let s=Et(async()=>{U(e),U(a.signal);let p=await n({pause:Z(a.signal),delay:He(a.signal),signal:a.signal});return U(a.signal),p},()=>L(a,Ct));return o?.autoJoin&&t.push(s.catch(H)),{result:Z(e)(s),cancel(){L(a,xt)}}}},un=(e,t)=>{let r=async(n,o)=>{U(t);let a=()=>{},p=[new Promise((c,A)=>{let i=e({predicate:n,effect:(u,y)=>{y.unsubscribe(),c([u,y.getState(),y.getOriginalState()])}});a=()=>{i(),A()}})];o!=null&&p.push(new Promise(c=>setTimeout(c,o,null)));try{let c=await Ke(t,Promise.race(p));return U(t),c}finally{a()}};return(n,o)=>xe(r(n,o))},bt=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=M(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(m(21));return ke(a,"options.listener"),{predicate:o,type:t,effect:a}},It=Object.assign(e=>{let{type:t,predicate:r,effect:n}=bt(e);return{id:b(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(m(22))}}},{withTypes:()=>It}),qe=e=>{e.pending.forEach(t=>{L(t,ge)})},ln=e=>()=>{e.forEach(qe),e.clear()},Pt=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Ee=Object.assign(M(`${Re}/add`),{withTypes:()=>Ee}),$e=M(`${Re}/removeAll`),we=Object.assign(M(`${Re}/remove`),{withTypes:()=>we}),pn=(...e)=>{console.error(`${Re}/error`,...e)},vt=(e={})=>{let t=new Map,{extra:r,onError:n=pn}=e;ke(n,"onError");let o=i=>(i.unsubscribe=()=>t.delete(i.id),t.set(i.id,i),u=>{i.unsubscribe(),u?.cancelActive&&qe(i)}),a=i=>{let u=$(Array.from(t.values()),y=>y.effect===i.effect);return u||(u=It(i)),o(u)};Object.assign(a,{withTypes:()=>a});let s=i=>{let{type:u,effect:y,predicate:k}=bt(i),l=$(Array.from(t.values()),h=>(typeof u=="string"?h.type===u:h.predicate===k)&&h.effect===y);return l&&(l.unsubscribe(),i.cancelActive&&qe(l)),!!l};Object.assign(s,{withTypes:()=>s});let p=async(i,u,y,k)=>{let l=new AbortController,h=un(a,l.signal),x=[];try{i.pending.add(l),await Promise.resolve(i.effect(u,cn({},y,{getOriginalState:k,condition:(f,d)=>h(f,d).then(Boolean),take:h,delay:He(l.signal),pause:Z(l.signal),extra:r,signal:l.signal,fork:dn(l.signal,x),unsubscribe:i.unsubscribe,subscribe:()=>{t.set(i.id,i)},cancelActiveListeners:()=>{i.pending.forEach((f,d,T)=>{f!==l&&(L(f,ge),T.delete(f))})},cancel:()=>{L(l,ge),i.pending.delete(l)},throwIfCancelled:()=>{U(l.signal)}})))}catch(f){f instanceof I||Pt(n,f,{raisedBy:"effect"})}finally{await Promise.all(x),L(l,Rt),i.pending.delete(l)}},c=ln(t);return{middleware:i=>u=>y=>{if(!(0,Mt.isAction)(y))return u(y);if(Ee.match(y))return a(y.payload);if($e.match(y)){c();return}if(we.match(y))return s(y.payload);let k=i.getState(),l=()=>{if(k===wt)throw new Error(m(23));return k},h;try{if(h=u(y),t.size>0){let x=i.getState(),f=Array.from(t.values());for(let d of f){let T=!1;try{T=d.predicate(y,x,k)}catch(g){T=!1,Pt(n,g,{raisedBy:"predicate"})}T&&p(d,y,i,l)}}}finally{k=wt}return h},startListening:a,stopListening:s,clearListeners:c}};var Dt=require("redux");var fn=e=>({id:b(),middleware:e,applied:new Map}),yn=e=>t=>t?.meta?.instanceId===e,Ot=()=>{let e=b(),t=new Map,r=Object.assign(M("dynamicMiddleware/add",(...p)=>({payload:p,meta:{instanceId:e}})),{withTypes:()=>r}),n=Object.assign(function(...c){c.forEach(A=>{let i=$(Array.from(t.values()),u=>u.middleware===A);i||(i=fn(A)),t.set(i.id,i)})},{withTypes:()=>n}),o=p=>{let c=Array.from(t.values()).map(A=>G(A.applied,p,{insert:()=>A.middleware(p)}));return(0,Dt.compose)(...c)},a=K(r,yn(e));return{middleware:p=>c=>A=>a(A)?(n(...A.payload),p.dispatch):o(p)(c)(A),addMiddleware:n,withMiddleware:r,instanceId:e}};var Nt=require("redux");var hn=e=>"reducerPath"in e&&typeof e.reducerPath=="string",An=e=>e.flatMap(t=>hn(t)?[[t.reducerPath,t.reducer]]:Object.entries(t)),Xe=Symbol.for("rtk-state-proxy-original"),Tn=e=>!!e&&!!e[Xe],mn=new WeakMap,Sn=(e,t)=>G(mn,e,{insert:()=>new Proxy(e,{get:(r,n,o)=>{if(n===Xe)return r;let a=Reflect.get(r,n,o);if(typeof a>"u"){let s=t[n.toString()];if(s){let p=s(void 0,{type:b()});if(typeof p>"u")throw new Error(m(24));return p}}return a}})}),gn=e=>{if(!Tn(e))throw new Error(m(25));return e[Xe]},kn=(e={})=>e;function jt(...e){let t=Object.fromEntries(An(e)),r=()=>Object.keys(t).length?(0,Nt.combineReducers)(t):kn,n=r();function o(p,c){return n(p,c)}o.withLazyLoadedSlices=()=>o;let a=(p,c={})=>{let{reducerPath:A,reducer:i}=p,u=t[A];return!c.overrideExisting&&u&&u!==i?(typeof process<"u",o):(t[A]=i,n=r(),o)},s=Object.assign(function(c,A){return function(u,...y){return c(Sn(A?A(u,...y):u,t),...y)}},{original:gn});return Object.assign(o,{inject:a,selector:s})}function m(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}
//# sourceMappingURL=redux-toolkit.production.min.cjs.map